<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html xmlns="http://www.w3.org/1999/xhtml">
  <body>
    <div th:fragment="pageSubmit">
      <div class="col-xs-12 col-sm-12">
	    <div class="col-xs-12 navbar-left navbar-form" style="padding-top: 10px;">
	        	<input type="button" onclick="funPage(1)" class="btn btn-primary" value="首页"/>
	        	<input type="button" onclick="funPage(2)" class="btn btn-primary" value="上一页"/>
	        	<input type="button" onclick="funPage(3)" class="btn btn-primary" value="下一页"/>
	        	<input type="button" onclick="funPage(4)" class="btn btn-primary" value="末页"/>
	        	<span>
	        	当前第<span id="nowpage">${list.current}</span>页
	        	[共<span id="totalnum">${list.total}</span>条,
	        	<span id="totalpages">${list.pages}</span>页]
	        	</span>
	        	
	        	<span style="font-size: 16px">第</span>&nbsp;&nbsp;
	        	<input type="text" id="topage"  class="form-control" style="width:50px;text-align: center;" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
	            <input type="button" onclick="funPage(5)" class="btn btn-primary" value="跳转"/>
	    </div>
	</div>
	<script>
	//处理分页
	function funPage(flag){
		 var page=parseInt($("#page").val());
		 var endnum=parseInt($("#endnum").val());
		 //如果是首页
		 if(flag==1){
			 page=1;
		 }
		 //如果是上一页
		 if(flag==2){
			 if(page<=1){
				 layer.msg("已经是第一页",{icon:7,time:1000});
				 return;
			 }
			 page=page-1;
		 }
		 //如果是下一页
		 if(flag==3){
			 if((page+1)>endnum){
				 layer.msg("已经是最后一页",{icon:7,time:1000});
				 return;
			 }
			 page=page+1;
		 }
		 //如果是末页
		 if(flag==4){
			 page=endnum;
		 }
		//如果是跳转
		 if(flag==5){
			var topage=parseInt($("#topage").val()==""?1:$("#topage").val());
			if(topage<1 || topage>endnum){
				layer.msg("请输入正确页面",{icon:7,time:1000});
				return;
			}
			page=topage;
		 }
		 $("#page").val(page);
		 $("#seachFrom").submit();
	}
	</script>
    </div>
  </body>
</html> 